<template>
  <div>
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>我的文章</span>
        <el-button
          style="float: right; padding: 8px 0"
          type="text"
          @click="handleManage"
        >
          管理我的文章
        </el-button>
      </div>
      <ul>
        <li>共有文章:{{ showCount('newsTotal') }} 条</li>
        <li>已发布:{{ showCount('pubNum') }} 条</li>
        <li>待发布:{{ showCount('unPubNum') }} 条</li>
      </ul>
    </el-card>
  </div>
</template>
<script>
export default {
  data() {
    return {}
  },
  props: ['data'],
  computed: {
    showCount() {
      return function (name) {
        return this.data.filter((v) => v.name == name)[0].num
      }
    },
  },
  mounted() {
    this.tableData = this.data.filter((v) => v.type == 3)
  },
  methods: {
    handleManage() {
      this.$router.push({
        name: 'article-manage',
      })
    },
  },
}
</script>
<style scoped lang="scss">
.box-card {
  min-height: 400px;
}
</style>